import SvgIcon from './SvgIcon/index.vue'
import Category from './Category/index.vue'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'

// Object.keys()得到对象所有的key并放在数组里, 用foreach遍历数组的所有key值
const allGlobalComponent = { SvgIcon, Category }
// console.log(Object.keys(allGlobalComponent));
//对外暴路

// main.ts中注册全局组件
// import SvgIcon from '@/components/SvgIcon/index.vue'
// app.component('SvgIcon',SvgIcon)
export default {
  install(app) {
    Object.keys(allGlobalComponent).forEach((key) => {
      app.component(key, allGlobalComponent[key]) //这里es6
      /* const dd = {
                'name':234,
                sh:234
              }
            console.log(dd['name']); 
            */
    })
    //全局注册element-plus图标
    for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
      app.component(key, component)
    }
  },
}
